<?php
session_start();
include("connection/connection.php");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<title>Vacom - Thư viện tài liệu</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<!-- TinyMCE -->
<script type="text/javascript" src="tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
	tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "advanced",
		plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",

		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,|,insertdate,inserttime,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,

		// Example content CSS (should be your site CSS)
		content_css : "css/content.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "lists/template_list.js",
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js",

		// Style formats
		style_formats : [
			{title : 'Bold text', inline : 'b'},
			{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
			{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
			{title : 'Example 1', inline : 'span', classes : 'example1'},
			{title : 'Example 2', inline : 'span', classes : 'example2'},
			{title : 'Table styles'},
			{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
		],

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});
</script>
<!-- /TinyMCE -->

</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="images/BG.gif">
<?php
	$login = 0;// Chua login
	if($_COOKIE['username'] !="")
	{
		// Da luu cookie
		$login = 1;
	}
	else
	{
		// Chua luu cookie
		if($_SESSION['username'] !="")
		{
			$login = 1;	
		}
	}

	if($login == 0)
	{
	?>
		<form action="login.php" method="post">
		<div class="adminlogin">
		<table class="reference" border="1" cellpadding="0" cellspacing="0" align="center" width="400">
			<tr>
				<td colspan="2" class="titleadminlogin">Login</td>
			</tr>
			<tr>
				<td width="140">Tên đăng nhập:</td>
				<td width="260"><input type="text" name="username" size="30" /></td>
			</tr>
			<tr>
				<td>Mật khẩu:</td>
				<td><input type="password" name="password" size="30" /></td>
			</tr>
			<tr>
				<td></td>
				<td><input type="checkbox" name="remember">Nhớ mật khẩu:</td>
			</tr>
			<tr>
				<td></td>
				<td><input type="submit" value="Đăng nhập"></td>
			</tr>
		</table>
		</div>
		</form>
	<?php
	}
	else
	{?>
		
		<table width="995" border="0" cellpadding="0" cellspacing="0" align="center">
			<tr>
				<td width="995">
				<!-- TOP -->
					<table  width="995" border="0" cellpadding="0" cellspacing="0" background="images/AdminCP_Top_BG.jpg">
						<tr>
							<td rowspan="4" width="19"></td>
							<td rowspan="4" background="" width="159"></td>
							<td width="817" height="29">
								<table width="817" height="29" border="0" cellpadding="0" cellspacing="0">
									<tr>
										<td width="608" height="29"></td>
										<td width="16" height="29">
											<img src="images/Home_Icon.jpg"></td>
										<td width="128" height="29" class="top1"><?php
											if($_SESSION['username'] !="")
											{
												echo "Xin chào : <font color=\"red\"> Admin</font>";
											}
										?></td>
										<td width="14" height="29">
											<img src="images/Logout_Icon.jpg"></td>
										<td width="51" height="29" class="top1"><a href="logout.php">Thoát</a></td>
									</tr>
								</table>
							</td>
						</tr>
						
					</table>
					<!-- /TOP -->
				</td>
			</tr>
			<tr>
				<td width="995px">
					<!-- Header -->
					<table width="995px" border="0" cellpadding="0" cellspacing="0" bgcolor="#d9e5f5">
						<tr>
							<td colspan="3" bgcolor="#3aaddc"><?php //include("menuleft.php");?></td>
						</tr>
						
						<tr>
							<td valign="top" width="995px">
							<!-- Noi Dung -->
								<?php include("maincontent.php");?>
							<!-- / Noi Dung -->
							</td>
						</tr>
					</table>
					<!-- End Header -->
				</td>
			</tr>
			<tr>
				<td align="center">
					<table border="0" cellpadding="0" cellspacing="0">
						
					</table>
				</td>
			</tr>
		</table>
		<!-- Powered by VCSS.VN -->
		
	<?php
	}
	?>
</body>
</html>